const state = {
    carList: []
  }
  const mutations = {
    SET_CARLIST(state, payload) {
      state.carList.push({ ...payload, isCheck: true })
    },
    SET_CAR_ISCHECK(state, id) {
      state.carList.forEach((ele, i) => {
        if (ele.id == id) {
          state.carList[i].isCheck = !ele.isCheck
        }
      })
    },
    SET_CAR_ISCHECK_F(state) {
      state.carList.forEach((ele, i) => {
        state.carList[i].isCheck = false
      })
    },
    SET_CAR_ISCHECK_T(state) {
      state.carList.forEach((ele, i) => {
        state.carList[i].isCheck = true
      })
    },
    DEL_CARLIST(state,id){
      state.carList.forEach((ele,i)=>{
        if(ele.id==id){
          state.carList.splice(i,1)
        }
      })
    }
  }
  const actions = {
  
  }
  
  export default {
    state, mutations, actions
  }